<?php 
$webroot="../";
if(session::is_manager()==TRUE)
{
	
	require_once '../html/admintemplate.php';
}
else 
{
	require_once '../html/template.php';
}
?>
<link rel="stylesheet" type="text/css" href="jquery.autocomplete.css">
<script type="text/javascript" src="jquery.min.js"></script>
<script src="jquery.autocomplete.js" type="text/javascript">
</script>
<script type="text/javascript">


function autocompletesearchbin() {
	var plan = $("#plan").val();
	if(plan=="our")
	{
		$("#bincc").autocomplete('search.php');
	}
	
};

function updatecart(ccid,price,ccnum,country)
{
	$("#freshcvvupdatecart").html("<img src='../images/loading.gif' />");
	$.ajax({
		url:"updatecart.php",
		type:'get',
		data:"ccid="+ccid+"&price="+price+"&ccnum="+ccnum+"&country="+country,
		cache: false,
		success: function(j){
		$("#freshcvvupdatecart").html(j);
	  	}
	});	
 	
}
function removeccid(id)
{
	$.ajax({
		url:"removecart.php",
		type:'get',
		data:"ccid="+id,
		cache: false,
		success: function(j){
			$.ajax({
				  url: "updatecart.php",
				  cache: false,
				  success: function(html){
				    $("#freshcvvupdatecart").html(html);
				  }
				});
	  	}
	});	
	
}

function emptycart()
{
	$.ajax({
		url:"removecart.php",
		type:'get',
		data:"empty=1",
		cache: false,
		success: function(j){
			$("#freshcvvupdatecart").html("Your Cart is now Empty");
	  	}
	});	
	
}
function findcountry()
{
	$("#freshcvvcountry").html("<img src='../images/loadingmini.gif' />");
	$("#freshcvvstate").html("<select id='state' ><option value='all'>Choose Country</option.</select>");
	$("#freshcvvtype").html("<select id='typecc' ><option value='all'>Choose Country</option.</select>");
	$.ajax({
		url:"findourcountry.php",
		type:'get',
		data:"plan="+$("#plan").val(),
		cache: false,
		success: function(j)
		{
			 $("#freshcvvcountry").html(j);
	  	}
	});
	
}
function findstate()
{
	$("#searchcc").html("<img src='../images/loadingmini.gif' />");
	$("#freshcvvstate").html("<img src='../images/loadingmini.gif' />");
	$("#freshcvvtype").html("<img src='../images/loadingmini.gif' />");
	$.ajax({
		url:"findourstate.php",
		type:'get',
		data:"plan="+$("#plan").val()+"&country="+$("#country").val(),
		cache: false,
		success: function(j){
			$("#freshcvvstate").html(j);
			$("#searchcc").html('<input name="submit" type="submit" onclick="javascript:searchcc();" value="Search CC" />');
			
	  	}
	});	
	
	$.ajax({
		url:"findourtype.php",
		type:'get',
		data:"plan="+$("#plan").val()+"&country="+$("#country").val(),
		cache: false,
		success: function(j){
			$("#freshcvvtype").html(j);
		}
	});	

}

</script>
<center>
<table>
<tr class="classarlert">
<td >
Agent<select name="plan" id="plan" onchange="javascript:findcountry();">
<option value="">Choose Agent</option>
<?php 
$GetAgent=buycc::findagent();
foreach($GetAgent as $ShowAgent)
{
	echo "<option value='".$ShowAgent['agent_class']."'>".$ShowAgent['agent_name']."</option>";
}
?>


</select>
</td>
<td>
Country
</td>
<td id="freshcvvcountry">
<select name="country" id="country" onclick="alert('You have to choose agent first');">
<option value="" >-----</option>
</select>
</td>
<td>
Type
</td>
<td id="freshcvvtype">
<select name="typecc" id="typecc" onclick="alert('You have to choose Country before click here');" >
<option value="" >None</option>
</select>
</td>
<td>
Bin
</td>
<td>
<input onfocus="javascript:autocompletesearchbin();" type="text" id="bincc">
</td>
<td>
State
</td>
<td id="freshcvvstate">
<select id="state" onclick="alert('You have to choose Country before click here');">
<option value="" >Choose State</option>
</select>
</td>
<td>Dob
<select name="dob" id="postdob" >
<option value="no" >NO</option>
<option value="yes" >YES</option>
</select> 
</td>
<td>
SSN
<select name="ssn" id="postssn" >
<option value="no" >NO</option>
<option value="yes" >YES</option>
</select>
</td>
<td  id="searchcc">
<input name="submit" type="submit" onclick="javascript:searchcc();" value="Search CC" />
</td>
</tr>

</table>
</center>